package com.hc.acoustics.ui.activity

import android.content.Intent
import android.os.Bundle
import com.hc.acoustics.R
import com.hc.acoustics.base.BaseActivity
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import java.util.concurrent.TimeUnit

/**
 *
 */
class WelcomeActivity : BaseActivity() {
    override fun getLayoutId(): Int {
        return R.layout.welcome_activity
    }

    var disposable: Disposable? = null
    override fun initView(savedInstanceState: Bundle?) {
        disposable = Observable.timer(1500, TimeUnit.MILLISECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe { l ->
                startActivity(Intent(this, MainActivity::class.java))
                finish()
                disposable?.dispose()
            }
    }

    override fun onDestroy() {
        disposable?.dispose()
        super.onDestroy()
    }
}